package com.fay.corejava.chapter4;

import com.fay.corejava.chapter2.Employee;

/**
 * @Title:
 * @Description:
 * @Author Fay Wang
 * @Date 2022/1/31 16:43
 * @Version 1.0
 */
public class Manager extends Employee {
    private double bonus;

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }

    public Manager(double bonus) {
        this.bonus = bonus;
    }

    public Manager() {
    }

    public Manager(String name, double salary, double bonus) {
        super(name, salary);
        this.bonus = bonus;
    }

    public Manager(String name, double salary) {
        super(name, salary);
    }

    @Override
    protected double getSalary() {
        // 子类不能直接访问父类的私有实例变量，super不同于this的对象引用，而是绕过动态查找方法，调用特定方法
        return super.getSalary() + bonus;
    }

    public void raiseSalary(double byPercent) {
        super.raiseSalary(byPercent);
    }


    @Override
    public Manager getSuperVisor() {
        return new Manager();
    }
}
